/**
 * (c) 2012 Samuel Nelson. All rights reserved
 */

// Our browser specific object
var helpplz_browser = new Array();

// Loads the stored list of accounts and passes the data to the given callback
helpplz_browser.load = function(callback) {
	chrome.extension.sendRequest({name: 'load'}, callback);
}

// Commits all changes to the list of accounts to local storage
helpplz_browser.save = function(lstore) {
	chrome.extension.sendRequest({
		name: 'commit',
		data: lstore});
}

// Fetches the JSON object at the given url and passes the result to the
// given callback on success. If used to fetch JSON from a different domain,
// server must support CORS
helpplz_browser.getJSON = function(url, callback) {
	$.getJSON(url, null, callback);
}